package com.wangsb.code0403;


import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


/**
 * @Description: TODO
 * @author: shenbing.wang@hand-china
 * @date: 2021年06月26日 14:47
 */
public class CopyFile {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(10);

        File srcFile = new File("F:/srcFile");
        File destFile = new File("F:/destFile");

        File[] files = srcFile.listFiles();
        if (files != null) {
            for (File file : files) {
                System.out.println("为文件" + file.getPath() + "开启线程");
                executorService.submit(new CopyFileCallableThread(file, destFile));
            }
        }
        executorService.shutdown();

    }

}
